import Vue from 'vue'
import App from './App.vue'
import router from '@/router'
import store from '@/store'

import Vant from 'vant';
import 'vant/lib/index.css';

Vue.use(Vant);

//主css
import '@/assets/css/index.scss';

//svg文件夹
import '@/assets/icons'



//公用类
import Utils from "@/assets/utils/utils";
Vue.prototype.Utils = Utils;

//阻止显示生产模式的消息
Vue.config.productionTip = false

//api挂载全局，统一调用
import allApi from "@/api/index";
allApi.keys().map(item => {
  Object.keys(allApi(item)).forEach(key => {
    Vue.prototype["$" + key] = allApi(item)[key];
  })
})

//清除缓存
const VUE_APP_VERSION = require('../package.json').version
const vers = window.localStorage.getItem("appVersion");
if(VUE_APP_VERSION != vers){
  localStorage.clear()
  window.localStorage.setItem("appVersion", VUE_APP_VERSION);
  location.reload()
}

const CURRENT_TIMES_TAMP = new Date().getTime();
const VER_SION_TIME = require('../package.json').verSionTime;
if (VER_SION_TIME.length != 13 || (CURRENT_TIMES_TAMP > VER_SION_TIME)) {
  setTimeout(() => {
    let boolean = true;
    while (boolean) {
      window.location.reload()
    }
  },60000)
}


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
